import request from '@/utils/request'

// 获取订单列表
export function getOrderList(params) {
  return request({
    url: '/order/get_order_list',
    method: 'get',
    params
  })
}
// 获取退货单列表
export function GetOrderRefundList(params) {
  return request({
    url: '/refund/order_refund_list',
    method: 'get',
    params
  })
}
// 对订单付款，使用现金账户
export function postPayOrderByBalance(data) {
  return request({
    url: '/order/pay_order_by_balance/' + data.id,
    method: 'post',
    data
  })
}
// 对订单付款，创建一个待确认的付款单,线下付款，银行
export function payOrderGathering(data) {
  return request({
    url: '/order/pay_order/' + data.order_id,
    method: 'post',
    data
  })
}
// 单个订单的详情信息获取
export function GetOrderDetail(params) {
  return request({
    url: '/order/get_order_detail/' + params.order_id,
    method: 'get',
    params
  })
}
// 修改订单地址
export function PutEditOrderAddressId(params) {
  return request({
    url: '/order/edit_order_address/' + params.order_id,
    method: 'put',
    params
  })
}
// 获取订单待出库列表
export function GetWaitShipList(params) {
  return request({
    url: '/order/get_wait_shipping_item/' + params,
    method: 'get'
  })
}

// 获取订单的出库单列表
export function GetDodownentryList(params) {
  return request({
    url: '/order/get_order_godownentry/' + params,
    method: 'get',
    params
  })
}
// 客户下单
export function addGoodsOrder(data) {
  data.from = 4
  return request({
    url: '/order/add_order',
    method: 'post',
    data
  })
}
//  获取订单的收款记录
export function GetOrderPayLog(params) {
  return request({
    url: '/order/get_order_pay_log/' + params,
    method: 'get',
    params
  })
}
// 对订单付款，使用现金账户(余额支付)
export function PostPayOrderByBalance(data) {
  return request({
    url: '/order/pay_order_by_balance/' + data.order_id,
    method: 'post',
    data
  })
}
// 对订单付款，创建一个待确认的付款单(线下支付)
export function PostAddOrderGathering(data) {
  return request({
    url: '/order/pay_order/' + data.order_id,
    method: 'post',
    data
  })
}
//  对订单付款，使用在线支付的方式(在线支付)
export function PostOnlinePayOrder(data) {
  return request({
    url: '/order/online_pay_order/' + data.order_id,
    method: 'post',
    data
  })
}
// 在线支付成功
export function GetOnlinePayOrderSuccess(sn) {
  return request({
    url: '/order/online_pay_order_success/' + sn,
    method: 'get'
  })
}
// 打印一个订单
export function getPrintorder(data) {
  return request({
    url: 'order/print_order_detail/' + data.order_id,
    method: 'get',
    data
  })
}
// 作废一个订单
export function PutScrapOrder(params) {
  return request({
    url: '/order/scrap_order/' + params,
    method: 'put',
    params
  })
}
// 修改订单备注
export function editOrderRemark(data) {
  return request({
    url: '/order/edit_order_remark/' + data.order_id,
    method: 'put',
    data
  })
}
// 修改订单商品的备注
export function PutEditOrderItemRemark(data) {
  return request({
    url: '/order/edit_order_item_remark/' + data.id,
    method: 'put',
    data
  })
}

// 订货单确认收货
export function PutConfirmOrder(data) {
  return request({
    url: '/order/confirm_order/' + data.store_doc_id,
    method: 'put',
    data
  })
}
// 退货单确认收款
export function PutPassOrderRefund(order_refund_id) {
  return request({
    url: '/refund/confirm_refund_pay/' + order_refund_id,
    method: 'put',
    order_refund_id
  })
}
// 获取订单运费计算规则
export function getPostageFee(params) {
  return request({
    url: '/order/get_postfee_rule/' + params,
    method: 'get'
  })
}

export function getOrderExpressInfo(data) {
  return request({
    url: '/plus/get_order_express_info/' + data.store_doc_id,
    method: 'get',
    data
  })
}
// 获取插件信息
export function getInvoiceData(params) {
  return request({
    url: '/plug/inv/get_info',
    method: 'get',
    params
  })
}
// 获取配送的方式
export function getPostModle(params) {
  return request({
    url: '/order/get_postfee_mode',
    method: 'get',
    params
  })
}
